home *** CD-ROM | disk | FTP | other *** search
/ PC Home 119 / PC Home issue 119.iso / Software / Essentials / hotdog65demo.exe / %MAINDIR% / HTMLFiles / hdscrlib.js
Encoding:
Text File  |  2002-12-03  |  6.7 KB  |  337 lines

  1. var isNav4, isIE
  2. var coll = ""
  3. var styleObj = ""
  4.  
  5. if (parseInt(navigator.appVersion) >= 4) {
  6.   if (navigator.appName == "Netscape") {
  7.     isNav4 = true
  8.   } else {
  9.     isIE = true
  10.     coll = "all."
  11.     styleObj = ".style"
  12.   }
  13. }
  14.  
  15. // Convert object name string or object reference
  16. // into a valid object reference
  17. function getObject(obj) {
  18.     var theObj
  19.     theObj = eval("document." + coll + obj + styleObj)
  20.     return theObj
  21. }
  22.  
  23. // Setting the visibility of an object to hidden
  24. function hdscrHideObject(Object) {
  25.     var theObj = getObject(Object)
  26.     theObj.visibility = "hidden"
  27. }
  28.  
  29. // Setting the visibility of an object to visible
  30. function hdscrShowObject(Object) {
  31.     var theObj = getObject(Object)
  32.     theObj.visibility = "visible"
  33. }
  34.  
  35.     //    hdscrBringForward(Object)
  36.     function hdscrBringForward(Object)
  37.     {
  38.            var theObj = getObject(Object)
  39.         theObj.zIndex += 1
  40.       }
  41.  
  42.     //    hdscrSendBackward(Object)
  43.     function hdscrSendBackward(Object)
  44.     {
  45.            var theObj = getObject(Object)
  46.         theObj.zIndex -= 1
  47.       }
  48.  
  49.     //    hdscrBringToFront(Object)
  50.     function hdscrBringToFront(Object)
  51.     {
  52.            var theObj = getObject(Object)
  53.         theObj.zIndex = 1
  54.       }
  55.  
  56.     //    hdscrSendToBack(Object)
  57.     function hdscrSendToBack(Object)
  58.     {
  59.            var theObj = getObject(Object)
  60.         theObj.zIndex = -1
  61.       }
  62.  
  63.     //    todo hdscrSetImage(Object, Image)
  64.     //    todo hdscrUseImage(Object, Image)
  65.  
  66.     //    todo hdscrFly(Object, StartX, StopX, StartY, StopY)
  67.  
  68.     //    hdscrMoveTo(Object, X, Y)
  69.     // Positioning an object at a specific pixel coordinate
  70.     function hdscrMoveTo(Object, X, Y)
  71.     {
  72.         var theObj = getObject(Object)
  73.         if (isNav4) {
  74.               theObj.moveTo(X,Y)
  75.         } 
  76.         else 
  77.         {
  78.               theObj.pixelLeft = X
  79.               theObj.pixelTop = Y
  80.         }
  81.     }
  82.  
  83.     //    hdscrMoveBy(Object, X, Y)
  84.     //    Moving an object by x and/or y pixels
  85.     function hdscrMoveBy(Object, X, Y)
  86.     {
  87.         var theObj = getObject(Object)
  88.         if (isNav4) {
  89.             theObj.moveBy(X, Y)
  90.         } 
  91.         else 
  92.         {
  93.             theObj.pixelLeft += X
  94.             theObj.pixelTop += Y
  95.         }
  96.     }
  97.  
  98.     //    todo hdscrBeginDrag(Object)
  99.     //    todo hdscrEndDrag(Object)
  100.  
  101.     //    hdscrGetTop(Object);';
  102.     // Retrieving the y coordinate of a positionable object
  103.     function getObjectTop(obj)  
  104.     {
  105.         var theObj = getObject(obj)
  106.         if (isNav4) 
  107.         {
  108.             return theObj.top
  109.         } 
  110.         else 
  111.         {
  112.             return theObj.pixelTop
  113.         }
  114.     }
  115.  
  116.     //    hdscrGetLeft(Object);';
  117.     //    Retrieving the x coordinate of a positionable object
  118.     function hdscrGetLeft(obj)  
  119.     {
  120.         var theObj = getObject(obj)
  121.         if (isNav4) 
  122.         {
  123.             return theObj.left
  124.         } 
  125.         else 
  126.         {
  127.             return theObj.pixelLeft
  128.         }
  129.     }
  130.  
  131.     //    todo hdscrGetPosition(Object);';
  132.     //    todo hdscrGetZ-Order(Object);';
  133.     //    todo hdscrGetClip Top(Object);';
  134.     //    todo hdscrGetClipBottom(Object);';
  135.     //    todo hdscrGetClipLeft(Object);';
  136.     //    todo hdscrGetClipRight(Object);';
  137.     //    todo hdscrGetImageSrc(Object);';
  138.     //    todo hdscrGetImageLowSrc(Object);';
  139.  
  140.     //    hdscrSetTop(Object, Top)'
  141.     function hdscrSetTop(Object, Top)
  142.     {
  143.         var theObj = getObject(Object)
  144.         if (isNav4) 
  145.         {
  146.             theObj.top = Top
  147.         } 
  148.         else 
  149.         {
  150.             theObj.pixelTop = Top
  151.         }
  152.     }
  153.  
  154.     //    hdscrSetLeft(Object, Left)';
  155.     function hdscrSetLeft(Object, Left)
  156.     {
  157.         var theObj = getObject(Object)
  158.         if (isNav4) 
  159.         {
  160.             theObj.left = Left
  161.         } 
  162.         else 
  163.         {
  164.             theObj.pixelLeft = Left
  165.         }
  166.     }
  167.  
  168.     //    hdscrSetPosition(Object, Top, Left)';
  169.     function hdscrSetPosition(Object, Top, Left)
  170.     {
  171.         var theObj = getObject(Object)
  172.         if (isNav4) 
  173.         {
  174.             theObj.top = Top
  175.             theObj.left = Left
  176.         } 
  177.         else 
  178.         {
  179.             theObj.pixelTop = Top            
  180.             theObj.pixelLeft = Left
  181.         }
  182.     }
  183.  
  184.   //    hdscrSetZOrder(Object, zOrder)';
  185.   // Setting the z-order of an object
  186.   function hdscrSetZOrder(Object, zOrder) {
  187.     var theObj = getObject(Object)
  188.     theObj.zIndex = zOrder
  189.   }
  190.  
  191.     //    todo hdscrSetClipTop(Object)';
  192.     //    todo hdscrSetClipBottom(Object)';
  193.     //    todo hdscrSetClipLeft(Object)';
  194.     //    todo hdscrSetClipRight(Object)';
  195.  
  196.     //    hdscrSetBGColor(Object, Color)';
  197.   // Setting the background color of an object
  198.   function hdscrSetBGColor(Object, Color) {
  199.     var theObj = getObject(Object)
  200.     if (isNav4) {
  201.       theObj.bgColor = Color
  202.     } else {
  203.       theObj.backgroundColor = Color
  204.     }
  205.   }
  206.  
  207.     //    todo hdscrSetImageSrc(Object)';
  208.     //    todo hdscrSetImageLowSrc(Object)';
  209.  
  210.   //     hdscrSetLocation(Object, URL);';
  211.   function hdscrSetLocation(Object, URL) {
  212.     window.location = URL
  213.   }
  214.  
  215.   //    hdscrAlert(Object, Message)';
  216.   function hdscrAlert(Object, Message) {
  217.         alert(Message)
  218.   }
  219.  
  220.   //    hdscrConfirmation(Object, Message)';
  221.   function hdscrConfirmation(Object, Message) {
  222.         confirm(Message)
  223.   }
  224.  
  225.   //    hdscrPrompt(Object, Message)';
  226.   function hdscrPrompt(Object, Message, Default) {
  227.         prompt(Message, Default)
  228.   }
  229.  
  230.   //    hdscrSetStatus(Object, Status);';
  231.   function hdscrSetStatus(Object, Status) {
  232.     window.statue = Message
  233.   }
  234.  
  235.   //    hdscrResizeTo(Object, Width, Height)';
  236.   // this only works for window object
  237.   function hdscrResizeTo(Object, Width, Height)
  238.   {
  239.     if (isNav4 | isIE)
  240.     {
  241.       resizeTo(Width, Height);
  242.     }
  243.   }
  244.  
  245.   //    hdscrResizeBy(Object, Width, Height)';
  246.   function hdscrResizeBy(Object, Width, Height)
  247.   {
  248.     if (isNav4 | isIE)
  249.     {
  250.       resizeBy(Width, Height);
  251.     }
  252.   }
  253.  
  254.   //    hdscrRepositionTo(Object, Top, Left, Width, Height)';
  255.   function hdscrRepositionTo(Object, Top, Left, Width, Height)
  256.   {
  257.     if (isNav4 | isIE)
  258.     {
  259.       resizeTo(Width, Height);
  260.       moveTo(Top, Left);
  261.     }
  262.   }
  263.  
  264.   //    hdscrRepositionBy(Object, Top, Left, Width, Height)';
  265.   function hdscrRepositionTo(Object, Top, Left, Width, Height)
  266.   {
  267.     if (isNav4 | isIE)
  268.     {
  269.       resizeBy(Width, Height);
  270.       moveBy(Top, Left);
  271.     }
  272.   }
  273.  
  274.   //    hdscrScrollTo(Object, X, Y)';
  275.   function hdscrScrollTo(Object, X, Y)
  276.   {
  277.     if (isNav4 | isIE)
  278.     {
  279.       ScrollTo(X, Y);
  280.     }
  281.   }
  282.  
  283.   //    hdscrScrollBy(Object, X, Y)';
  284.   function hdscrScrollBy(Object, X, Y)
  285.   {
  286.     if (isNav4 | isIE)
  287.     {
  288.       ScrollBy(X, Y);
  289.     }
  290.   }
  291.  
  292.   //    hdscrClose(Object)';
  293.   function hdscrClose(Object)
  294.   {
  295.     close();
  296.   }
  297.  
  298.   //    hdscrFocus(Object)';
  299.   function hdscrFocus(Object)
  300.   {
  301.     focus();
  302.   }
  303.  
  304.   //    hdscrBlur(Object)';
  305.   function hdscrBlur(Object)
  306.   {
  307.     blur();
  308.   }
  309.  
  310.   //    todo hdscrGetOpener(Object)';
  311.  
  312.   //    todo hdscrGetName(Object)';
  313.  
  314.   //    hdscrSetName(Object, Name)';
  315.   function hdscrSetName(Object, Name)
  316.   {
  317.     var theObj = getObject(Object)
  318.     theObj.name = Name;
  319.   }
  320.  
  321.   //    hdscrOpenNew(Object)';
  322.   function hdscrOpenNew(Object, URL, Name)
  323.   {
  324.     var newWindow = window.open(Object, URL, Name);
  325.     newWindow.focus();
  326.   }
  327.  
  328.   //    todo hdscrSendMessage(Object, Message)';
  329.  
  330.   //    todo hdscrCheckBrowser(Object)';
  331.  
  332.   //    todo hdscrCustom(Object)';
  333.  
  334.  
  335.  
  336.  
  337.